#ifdef Q_OS_LINUX
#include <X11/Xlib.h>
#include <X11/Xatom.h>

void setLinuxTitleBarTheme(QWidget *window, const QString &theme) {
    // 获取X11显示和窗口
    Display *display = XOpenDisplay(nullptr);
    Window xwindow = static_cast<Window>(window->winId());
    
    // 设置窗口主题属性（取决于桌面环境）
    Atom _GTK_THEME_VARIANT = XInternAtom(display, "_GTK_THEME_VARIANT", False);
    Atom UTF8_STRING = XInternAtom(display, "UTF8_STRING", False);
    
    if (_GTK_THEME_VARIANT && UTF8_STRING) {
        unsigned char *themeData = reinterpret_cast<unsigned char*>(theme.toUtf8().data());
        XChangeProperty(display, xwindow, _GTK_THEME_VARIANT, UTF8_STRING, 8, 
                        PropModeReplace, themeData, theme.length());
    }
    
    XCloseDisplay(display);
}
#endif
